<%@ page contentType="text/html; charset=UTF-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%@ taglib prefix="string" uri="http://jakarta.apache.org/taglibs/string-1.1" %>
<%@ taglib uri="/WEB-INF/tlds/pagination.tld" prefix="pagination" %>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags"%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
    <title>Dayve web</title>
    <link href="/common/css/style.css" rel="stylesheet" type="text/css"/>
    <script type="text/javascript">
        // 페이지 이동을 처리한다.
        function goListPage(page) {
            var TheForm = document.frm;
            TheForm.currentPage.value = page;
            TheForm.nextTarget.value = 'admin';
            TheForm.action = './admin.do';
            TheForm.submit();
        }

        // 검색어로 리스트를 출력한다.
        function jsSearchList() {
            var TheForm = document.frm;
            TheForm.writer_id.value = TheForm.search_writer.value;
            TheForm.writer_nick_name.value = TheForm.search_nickName.value;
            TheForm.content.value = TheForm.search_content.value;
            TheForm.nextTarget.value = 'admin';
            TheForm.action = './admin.do';
            TheForm.submit();
        }

        // 글쓰기 페이지로 이동 : 세션이 존재할 때만 가능
        function jsWriteBoard() {
            var TheForm = document.frm;
            TheForm.nextTarget.value = 'communityBoardWrite';
            TheForm.action = './communityBoardWrite.do';
            TheForm.submit();
        }

        // 게시물 보기 페이지로 이동
        function jsContentView() {
            var TheForm = document.frm;
            TheForm.nextTarget.value = 'communityBoardContent';
            TheForm.action = './communityBoardContent.do';
            TheForm.submit();
        }

        // Community Board List 페이지로 이동한다.
        function jsCommunityBoardList() {
            var TheForm = document.menuFrm;
            TheForm.nextTarget.value = "communityBoardList";	// page name
            TheForm.action = "./communityBoardList.do";
            TheForm.submit();
        }

        // Photo Board List 페이지로 이동한다.
        function jsPhotoBoardList() {
            var TheForm = document.menuFrm;
            TheForm.nextTarget.value = "photoBoardList";	// page name
            TheForm.action = "./photoBoardList.do";
            TheForm.submit();
        }

        // Notice Board List 페이지로 이동한다.
        function jsNoticeBoardList() {
            var TheForm = document.menuFrm;
            TheForm.nextTarget.value = "noticeBoardList";	// page name
            TheForm.action = "./noticeBoardList.do";
            TheForm.submit();
        }

        // Contact Us 페이지로 이동한다.
        function jsContactUs() {
            var TheForm = document.menuFrm;
            TheForm.nextTarget.value = "contactus";	// page name
            TheForm.action = "./contactus.do";
            TheForm.submit();
        }

        // FAQ 페이지로 이동한다.
        function jsFAQ() {
            var TheForm = document.menuFrm;
            TheForm.nextTarget.value = "faq";	// page name
            TheForm.action = "./faq.do";
            TheForm.submit();
        }

        // 문의를 타입별로 볼수 있게 한다.
        function jsTypedFAQ(faq_type){
            var TheForm = document.frm;
            TheForm.faq_idx.value = document.getElementById("select2").selectedIndex;
            TheForm.faq_type.value = faq_type;
            TheForm.action = "./admin.do";
            TheForm.submit();
        }


        // 문의 사항 선택 유지
        function jsAdminLoaded(){
            var TheForm = document.frm;
            var faq_idx = TheForm.faq_idx.value;
            if((faq_idx!=null) && (faq_idx.length>0)){
                document.getElementById("select2").selectedIndex = faq_idx;
            }
        }
    </script>
</head>


<body onload="jsAdminLoaded();">
<div id="wrapper" >
    <!------------------------------ top 시작-------------------------------------->
    <%@include file="header.jsp" %>
    <!------------------------------ top 끝-------------------------------------->
    <div class="mypage_content">
        <form name="frm" method="POST">
            <input type="hidden" name="contact_no" value="">
            <input type="hidden" name="writer_id" value="${param.search_writer}">
            <input type="hidden" name="writer_nick_name" value="${param.search_nickName}">
            <input type="hidden" name="content" value="${param.search_content}">
            <input type="hidden" name="nextTarget" value="">
            <input type="hidden" name="faq_type" value="${faq_type}">
            <input type="hidden" name="faq_idx" value="${faq_idx}">
            <input type="hidden" name="currentPage" value="${currentPage}">

            <img src="/images/intro/sub_title08.gif"  />
            <input name="Input" class="admin_button_on" value="<spring:message code="admin.topButton1" />" />
            <a href="adminMemberList.do?id&nick_name&email"><input name="Input" class="admin_button_off" value="<spring:message code="admin.topButton2" />" onclick="location.href=" /></a>
            <a href="adminStatistic.do"><input name="Input" class="admin_button_off" value="<spring:message code="admin.topButton3" />" /></a>
            <div class="admin_qnaview">
                <a href="adminComplete.do"><img src="/images/intro/btn_qnaview.gif" /></a>
            </div>
            <p class="admin_subtitle"><spring:message code="admin.subtitle" /></p>
            <p class="contactus">
                <spring:message code="admin.category" />
                <select name="select2" size="1" id="select2" class="admin_select" onchange="jsTypedFAQ(this.value);">
                    <option value="all"><spring:message code="admin.category.all" /></option>
                    <option value="bug"><spring:message code="admin.category.bug" /></option>
                    <option value="nml"><spring:message code="admin.category.nml" /></option>
                    <option value="req"><spring:message code="admin.category.req" /></option>
                    <option value="etc"><spring:message code="admin.category.etc" /></option>
                </select>
            </p>
            <table class="mypage_tb">
                <tr>
                    <td class="admin_no">NO</td>
                    <td class="admin_label">CATEGORY</td>
                    <td class="admin_label">ID</td>
                    <td class="admin_label">NICK_NAME</td>
                    <td class="admin_label">EMAIL</td>
                    <td class="admin_label">CONTENT</td>
                    <td class="admin_lastlabel">REGISTER_DATE</td>
                </tr>
                <c:set var="totalCount" value="${totalRow}"/>
                <c:forEach items="${contactList}" var="contactList" varStatus="serviceStatus" begin="0" end="20"
                           step="1">
                <tr>
                    <td class="admin_data">${contactList.contact_no}</td>
                    <td class="admin_data"><spring:message code="admin.${contactList.category}" /></td>
                    <td class="admin_data">${contactList.writer_id}</td>
                    <td class="admin_data">${contactList.writer_nick_name}</td>
                    <td class="admin_data">${contactList.writer_email}</td>
                    <td class="admin_dataleft"><a href="./adminContact.do?boardno=${contactList.contact_no}&page=${currentPage}&flag=0">${contactList.content}</a></td>
                    <td class="admin_data">${contactList.register_date}</td>
                </tr>
                </c:forEach>
            </table>
            <!------------------------- 페이징 ------------------------------------------>
            <div class="content_center">
                <pagination:paging>
                    <pagination:function>goListPage</pagination:function> <!-- 자바스크립트 함수 -->
                    <pagination:currentPage>${currentPage}</pagination:currentPage> <!-- 현재페이지 -->
                    <pagination:totalRows>${totalRow}</pagination:totalRows> <!-- 전체글수 -->
                    <pagination:pageSize>${pageSize}</pagination:pageSize> <!-- 페이지당 조회건수 -->
                </pagination:paging>
                <!--
                <img src="/images/intro/btn_first.gif" class="tb_btn" />
                <img src="/images/intro/btn_prev.gif" class="tb_btn" />
                1 2 3 4 5
                <img src="/images/intro/btn_next.gif" class="tb_btn" />
                <img src="/images/intro/btn_last.gif" class="tb_btn" />
                -->
            </div>
            <!------------------------- 페이징 끝 -------------------------------------->
            <table class="search_tb">
                <tr>
                    <td >&nbsp;</td>
                    <td width="21%" class="search_text">ID :</td>
                    <td width="21%" class="search_text">Nickname : </td>
                    <td width="21%" class="search_text">Content :</td>
                    <td width="21%" class="search_text">&nbsp;</td>
                </tr>
                <tr>
                    <td>&nbsp;</td>
                    <td><input type="text" name="search_writer" id="search_writer" class="admin_input"  value="${param.search_writer}" /></td>
                    <td><input type="text" name="search_nickName" id="search_nickName" class="admin_input"  value="${param.search_nickName}"/></td>
                    <td><input type="text" name="search_content" id="search_content" class="admin_input"  value="${param.search_content}" /></td>
                    <td><a href="javascript:jsSearchList()"><img src="/images/intro/btn_search.gif"  /></a></td>
                </tr>
            </table>
        </form>
    </div>
    <!------------------------------ 하위메뉴 시작-------------------------------------->
    <%@include file="footer.jsp" %>
    <!------------------------------ 하위메뉴 끝-------------------------------------->
</div>
</body>
</html>